from clockwork import clockwork

class datetime_fake :
    def __init__ ( self ) :
        class _datetime_fake :
            def __init__ ( self , datetime ) :
                self . _datetime = datetime
            def now ( self ) :
                class _now_fake :
                    def __init__ ( self , year , month , day , hour , minute ) :
                        self . year = year
                        self . month = month
                        self . day = day
                        self . hour = hour
                        self . minute = minute
                return _now_fake \
                    ( self . _datetime . _year 
                    , self . _datetime . _month 
                    , self . _datetime . _day 
                    , self . _datetime . _hour 
                    , self . _datetime . _minute
                    )
        self . _year = None
        self . _month = None
        self . _day = None
        self . _hour = None
        self . _minute = None
        self . datetime = _datetime_fake ( self )

class mediator_fake :
    def __init__ ( self ) :
        self . _current_time_reply = None
    def current_time_reply ( self , time ) :
        self . _current_time_reply = time

class clockwork_tests :
    'clockwork'
    def __init__ ( self , test ) :
        self . _test = test
        self . _datetime_fake = datetime_fake ( )
        self . _mediator = mediator_fake ( )
        self . _clockwork = clockwork ( self . _mediator , self . _datetime_fake )
    def test_date_format ( self ) :
        self . _datetime_fake . _year = 2010
        self . _datetime_fake . _month = 11
        self . _datetime_fake . _day = 17
        self . _datetime_fake . _hour = 16
        self . _datetime_fake . _minute = 38
        self . _clockwork . current_time_request ( )
        self . _test . assume_equal ( self . _mediator . _current_time_reply , '10.11.17-16:38' )
    def test_short_numbers_date_format ( self ) :
        self . _datetime_fake . _year = 2009
        self . _datetime_fake . _month = 3
        self . _datetime_fake . _day = 6
        self . _datetime_fake . _hour = 7
        self . _datetime_fake . _minute = 1
        self . _clockwork . current_time_request ( )
        self . _test . assume_equal ( self . _mediator. _current_time_reply , '09.03.06-07:01' )
